package com.gaussian.property.admin.module.biz.vo.monitor;

import com.songqi.common.core.validationgroup.EditGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;

/**
 * @description:
 * @author: songqi(13776346982)
 * @date: 2024/9/29 21:46
 */
@Data
public class ProjectMonitorForm {


    @ApiModelProperty("项目id")
    @NotBlank(message = "项目id不能为空")
    private String projectId;



    @Valid
    @NotEmpty(message = "指标条件不能为空")
    private List<IndicatorCondition> indicatorConditionList;


    @Data
    public static class IndicatorCondition{

        /**
         * 项目监控指标id
         */
        @ApiModelProperty("项目监控指标id")
        @NotBlank(message = "项目监控指标id不能为空", groups = {EditGroup.class})
        private String projectMonitorIndicatorId;

        @ApiModelProperty("监控指标id")
        @NotBlank(message = "监控指标id不能为空")
        private String monitorIndicatorId;

        /**
         * 比较运算符。gt,ge,eq,lt,le
         */
        @ApiModelProperty("比较运算符。gt,ge,eq,lt,le")
        @NotBlank(message = "比较运算符不能为空")
        @Pattern(regexp = "gt|ge|eq|lt|le", message = "比较运算符参数值不合法。")
        private String comparisonOperator;

        /**
         * 比较值
         */
        @ApiModelProperty("比较值")
        @NotBlank(message = "比较值不能为空")
        @Pattern(regexp = "^(0|[1-9]\\d*(\\.\\d+)?|0\\.\\d+)$", message = "比较值不是合法的数值")
        private String comparisonValue;

        /**
         * 启用标记。1-启用，0-停用
         */
        @ApiModelProperty("启用标记。1-启用，0-停用")
        @NotNull(message = "启用标记不能为空")
        @Min(value = 0, message = "启用标记。1-启用，0-停用")
        @Max(value = 1, message = "启用标记。1-启用，0-停用")
        private Integer enableStatus;
    }



}
